<?php
/**
 * Created by JetBrains PhpStorm.
 * User: avnovoselov
 * Date: 21.10.12
 * Time: 12:51
 * To change this template use File | Settings | File Templates.
 */
class db
{
    public static $link = false;

    public static function connect(array $data = array())
    {
        $default  =array(
            'host'  => 'localhost',
            'user'  => 'root',
            'pass'  => '',
            'base'  => 'chpock.dev',
        );

        $data = array_merge($default, $data);
        if (self::$link = mysqli_connect($data['host'], $data['user'], $data['pass'], $data['base']))
        {
            return true;
        }
        return false;
    }

    public static function q(string $query)
    {
        $sql = mysqli_query($query);
        return mysqli_fetch_all($sql);
    }
}
